package use_case.processRental;
import java.util.Calendar;

import use_case.handlereturns.Storage;

public class Sale {

	//Instance of a Class
	private Checkout cart;
	private Storage inventory;
	private Calendar currentDay;
	private Calendar dueDay = null;
	private Calendar returnDay = null;
	
	public Storage getInventory( ) { return inventory; }
	
	//Constructor
	public Sale(Storage inventory)
	{
		//Create Object of Class
		cart = new Checkout();
		currentDay = Calendar.getInstance();
		dueDay = currentDay;
		dueDay.roll(Calendar.DATE, true);
		//Assign Reference 
		this.inventory = inventory;
	}
	
	// Remove Item from Shopping Cart
	public void removeItemFromCart(int itemToRemove) {
		cart.removeItemFromCart(itemToRemove);
			
	}
	
	//Add Item to shopping cart from inventory List
	public void addItem(int itemNumber)
	{
		if(itemNumber < inventory.getSize())
		{
			cart.addItem(inventory.getItem(itemNumber));
		}	
	}
	
	//***********************************************
	//Utility Functions
	public String[] getSelectedList(){
		String[] L = cart.getSelectedList();
		return L;
	}

	public Calendar getDate(){return currentDay;}
	
	public void setDueDate(Calendar dueDay) {this.dueDay = dueDay;}
	public Calendar getDueDate() {return dueDay;}
	
	public void setReturnDate(Calendar returnDay){this.returnDay = returnDay;}
	public Calendar getReturnDate(){return returnDay;}
	
	public double getTotal(){return cart.getTotal();}

	public Checkout getCheckout(){return cart;}
	//***********************************************
}
